package cn.com.ahao.gateway.util;

import java.text.SimpleDateFormat;
import java.util.Date;

public class DateUtil {

    public static final String yyyyMMdd = "yyyyMMdd";
    public static final String yyyyMMddHHmmss = "yyyyMMddHHmmss";

    public static String format(Date date, String pattern) {
        SimpleDateFormat sdf = new SimpleDateFormat(pattern);
        return sdf.format(date);
    }

    public static String format(Date date) {
        return format(date, yyyyMMdd);
    }

    public static String formatNow() {
        return format(new Date());
    }

}
